@extends('admin.layouts.admin')
@section('content')
    <div class="card">
        <div class="card-body">
            <ul class="nav nav-tabs nav-overflow header-tabs">
                <li class="nav-item">
                    <a href="{{route('admin.category.index')}}" class="nav-link pb-3  ">
                        栏目列表
                    </a>
                </li>
                <li class="nav-item">
                    <a href="{{route('admin.category.create')}}" class="nav-link pb-3 active">
                        发表栏目
                    </a>
                </li>
            </ul>
        </div>
        <form action="{{route('admin.category.update',$category)}}" method="post">
            @csrf @method('PUT')
            <div class="card-body">
                <div class="card">
                    <div class="card-body">
                        <div class="form-group">
                            <label>栏目名称</label>
                            <input type="text" name="title" value="{{$category['title']}}" required class="form-control" placeholder="" aria-describedby="helpId">
                            <div class="form-group">
                                <label>父级栏目</label>
                                <select name="parent_id" class="form-control">
                    {{--这里只需要再前台加一个显示顶级栏目的选项,后台数据库中不需要单独给顶级栏目再存一条--}}
                                    <option value="0">顶级栏目</option>
                                    @foreach($formatCategoryTree as $item)
                                    <option value="{{$item['id']}}"
                                    {{$item['_disabled']}} {{$item['_selected']}}>
                                        {!! $item['_title'] !!}</option>
                                        @endforeach
                                </select>
                            </div>
                            <div class="form-group">
                                <label>栏目描述</label>
                                <textarea name="description" class="form-control"  rows="3">{{$category['description']}}</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-footer text-muted">
                    <button class="btn btn-primary btn-sm">保存提交</button>
                </div>
            </div>
        </form>
    </div>
@endsection
